package eventplanner.rest.exceptionmappers;

import eventplanner.ejb.exceptions.NoSuchEntityFoundException;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

@Provider
public class RestNoSuchEntityFoundExceptionHandler implements ExceptionMapper<NoSuchEntityFoundException> {

	@Override
	public Response toResponse(NoSuchEntityFoundException e) {
		return Response.status(Response.Status.NOT_FOUND).type(MediaType.TEXT_PLAIN_TYPE).entity(e.getMessage()).build();
	}
}
